/*
 * lab9B1.c
 *
 * CSIS 248 Operating System Programming
 */
#include <stdio.h>
#include <string.h>

#define SIZE1 10
#define SIZE2 12


int main( ){
   char a[SIZE1] = "Hello";
   char b[SIZE2] = "CSIS 248";

   int alen = strlen( a );
   int blen = strlen( b );

   printf("a = %s and has length = %d\n", a, alen );
   printf("b = %s and has length = %d\n", b, blen );
   printf("\n");
   printf("a = %p", a );
   printf(" and a points to: %c\n", *a);
   printf("b = %p", b );
   printf(" and b points to: %c\n\n", *b);


   /* Pointer */
   char c = 'f';
   char* d = &c;
//   *d = 'g';
   printf("c = %c\n", c );
   printf("d = %p", d );
   printf(" and d points to: %c\n", *d);

   /* Change d */
   d = a;
   printf("After d = a, d = %p\n", d );
   printf("  the string pointed to by d is %s\n", d );
   printf("  and d points to: %c\n\n", *d);
   d = b;
//   d[1] = 'u';
   printf("After d = b, d = %p\n", d );
   printf("  the string pointed to by d is %s\n", d );
   printf("  and d points to: %c\n\n", *d);

   /* Search for substrings */
   char* e = strstr( a, "ll" );
   printf("e = %s and has length = %d\n\n", e, (int)strlen(e) );

   /* Concatenate a and b */
   char x[SIZE1+SIZE2];
//   strcat()
//   printf("a and b concatenated = %s and its length is %d\n", x,  );
}
